home *** CD-ROM | disk | FTP | other *** search
/ Computer Music 2004 January / Computer Music Magazine 68 2004.iso / pc / Software / MAC Software / Full Software / Free Effects Mac / Smartelectronix - Bram / Madshifta OS9x OSX / source / dfx-library / dfxgui.h < prev   
Encoding:
C/C++ Source or Header  |  2002-08-08  |  11.3 KB  |  335 lines

  1. //=============================================================================
  2. // Destroy FX GUI objects by Marc Poirier
  3. // --------------------------------------
  4. // * CHorizontalSliderChunky
  5. // * CVerticalSliderChunky
  6. // * CHorizontalAnimSlider
  7. // * CVerticalAnimSlider
  8. // * CNumberBox
  9. // * CMultiToggle
  10. // * CWebLink
  11. // * CFineTuneButton
  12. // * CKickSpot
  13. //=============================================================================
  14.  
  15. #ifndef __dfxgui
  16. #define __dfxgui
  17.  
  18. #ifndef __vstgui__
  19. #include "vstgui.h"
  20. #endif
  21.  
  22.  
  23. //-----------------------------------------------------------------------------
  24. //    Chunky Horizontal Slider
  25. // a CHorizontalSlider replacement that "clicks" into each of its value positions
  26. //-----------------------------------------------------------------------------
  27. class CHorizontalSliderChunky : public CHorizontalSlider
  28. {
  29. public:
  30.     CHorizontalSliderChunky(const CRect &size, CControlListener *listener, long tag, 
  31.                        long    iMinXpos,    // min X position in pixel
  32.                        long    iMaxXpos,    // max X position in pixel
  33.                        long    numSteps,    // the number of value positions (chunky)
  34.                        CBitmap *handle,     // bitmap slider
  35.                        CBitmap *background, // bitmap background    
  36.                        CPoint  &offset,
  37.                        long    style = kLeft); // style (kRight, kLeft));
  38.   
  39.     virtual ~CHorizontalSliderChunky();
  40.   
  41.     virtual void draw(CDrawContext*);
  42.  
  43. protected:
  44.     // these are sort of dummy variables, they are doubles of 
  45.     // variables that are in CHorizontalSlider, but they have 
  46.     // different names in VSTGUI 2.2 than they do in earlier 
  47.     // versions, so I've made my own versions to avoid problems
  48.     // (in VSTGUI, they are called iMinPos & iMaxPos, but in 
  49.     // earlier VSTGUI versions they are called iMinXPos & iMaxXPos)
  50.     long iMinXpos;    // min X position in pixel
  51.     long iMaxXpos;    // max X position in pixel
  52.  
  53.     long numSteps;
  54. };
  55.  
  56.  
  57. //-----------------------------------------------------------------------------
  58. //    Chunky Vertical Slider
  59. // a CVerticalSlider replacement that "clicks" into each of its value positions
  60. //-----------------------------------------------------------------------------
  61. class CVerticalSliderChunky : public CVerticalSlider
  62. {
  63. public:
  64.     CVerticalSliderChunky(const CRect &size, CControlListener *listener, long tag, 
  65.                        long    iMinYpos,    // min Y position in pixel
  66.                        long    iMaxYpos,    // max Y position in pixel
  67.                        long    numSteps,    // the number of value positions (chunky)
  68.                        CBitmap *handle,     // bitmap slider
  69.                        CBitmap *background, // bitmap background    
  70.                        CPoint  &offset,
  71.                        long    style = kBottom); // style (kTop, kBottom));
  72.   
  73.     virtual ~CVerticalSliderChunky();
  74.   
  75.     virtual void draw(CDrawContext*);
  76.  
  77. protected:
  78.     // these are sort of dummy variables, they are doubles of 
  79.     // variables that are in CVerticalSlider, but they have 
  80.     // different names in VSTGUI 2.2 than they do in earlier 
  81.     // versions, so I've made my own versions to avoid problems
  82.     // (in VSTGUI, they are called iMinPos & iMaxPos, but in 
  83.     // earlier VSTGUI versions they are called iMinYPos & iMaxYPos)
  84.     long iMinYpos;    // min Y position in pixel
  85.     long iMaxYpos;    // max Y position in pixel
  86.  
  87.     long numSteps;
  88. };
  89.  
  90.  
  91.  
  92. //-----------------------------------------------------------------------------
  93. //    Horizontal Animated Slider
  94. // a CHorizontalSlider replacement that displays a bitmap sequence rather than 
  95. // a bitmap handle moving across a background
  96. //-----------------------------------------------------------------------------
  97. class CHorizontalAnimSlider : public CHorizontalSlider
  98. {
  99. public:
  100.     CHorizontalAnimSlider(const CRect &size, CControlListener *listener, long tag, 
  101.                        long    subPixmaps,    // number of subpixmaps
  102.                        long    heightOfOneImage, // pixel 
  103.                        long    iMinXPos,    // min X position in pixel
  104.                        long    iMaxXPos,    // max X position in pixel
  105.                        CBitmap *background, // bitmap background    
  106.                        CPoint  &offset,
  107.                        long    style = kLeft); // style (kRight, kLeft));
  108.   
  109.     virtual ~CHorizontalAnimSlider();
  110.   
  111.     virtual void draw(CDrawContext*);
  112. //    virtual void mouse(CDrawContext *pContext, CPoint &where);
  113.  
  114. protected:
  115.     long heightOfOneImage;
  116.     long subPixmaps;
  117. };
  118.  
  119.  
  120. //-----------------------------------------------------------------------------
  121. //    Vertical Animated Slider
  122. // a CVerticalSlider replacement that displays a bitmap sequence rather than 
  123. // a bitmap handle moving across a background
  124. //-----------------------------------------------------------------------------
  125. class CVerticalAnimSlider : public CVerticalSlider
  126. {
  127. public:
  128.     CVerticalAnimSlider(const CRect &size, CControlListener *listener, long tag, 
  129.                        long    subPixmaps,    // number of subpixmaps
  130.                        long    heightOfOneImage, // pixel 
  131.                        long    iMinYPos,    // min Y position in pixel
  132.                        long    iMaxYPos,    // max Y position in pixel
  133.                        CBitmap *background, // bitmap background    
  134.                        CPoint  &offset,
  135.                        long    style = kBottom); // style (kBottom, kTop));
  136.   
  137.     virtual ~CVerticalAnimSlider();
  138.   
  139.     virtual void draw(CDrawContext*);
  140. //    virtual void mouse(CDrawContext *pContext, CPoint &where);
  141.  
  142. protected:
  143.     long heightOfOneImage;
  144.     long subPixmaps;
  145. };
  146.  
  147.  
  148.  
  149. //-----------------------------------------------------------------------------
  150. //    Number Box
  151. // a CParamDisplay that you can click on & drag up & down or left & right to 
  152. // change the associated parameter's value (like the number boxes in Max/MSP)
  153. //-----------------------------------------------------------------------------
  154. class CNumberBox : public CControl
  155. {
  156. public:
  157.     CNumberBox(const CRect &size, CControlListener *listener, long tag, 
  158.                         CBitmap *background = 0, 
  159.                         long textStyle = 0,    // style (kShadowText, k3DIn, k3DOut, kNoTextStyle, kNoDrawStyle)
  160.                         long controlStyle = kVertical);    // style (kHorizontal, kVertical, or both)
  161.     virtual ~CNumberBox();
  162.     
  163.     virtual void setFont(CFont fontID);
  164.     CFont getFont() { return fontID; }
  165.  
  166.     virtual void setFontColor(CColor color);
  167.     CColor getFontColor() { return fontColor; }
  168.  
  169.     virtual void setBackColor(CColor color);
  170.     CColor getBackColor() { return backColor; }
  171.  
  172.     virtual void setFrameColor(CColor color);
  173.     CColor getFrameColor() { return frameColor; }
  174.  
  175.     virtual void setShadowColor(CColor color);
  176.     CColor getShadowColor() { return shadowColor; }
  177.  
  178.     virtual void setHoriAlign(CHoriTxtAlign hAlign);
  179.     virtual void setBackOffset(CPoint &offset);
  180.  
  181.     virtual void setStringConvert(void (*convert) (float value, char *string));
  182.     virtual void setStringConvert(void (*convert) (float value, char *string, void *userDta),
  183.                                     void *userData);
  184.     virtual void setString2FloatConvert(void (*convert) (char *string, float &output));
  185.  
  186.     virtual void setStyle(long val);
  187.     long getStyle() { return textStyle; }
  188.     virtual void setControlStyle(long val) { controlStyle = val; }
  189.     virtual long getControlStyle() { return controlStyle; }
  190.  
  191.     virtual void setTxtFace(CTxtFace val);
  192.     CTxtFace getTxtFace() { return txtFace; }
  193.  
  194.     virtual void draw(CDrawContext *pContext);
  195.     virtual void mouse(CDrawContext *pContext, CPoint &where);
  196.  
  197.     virtual void setTextTransparency(bool val) { bTextTransparencyEnabled = val; }
  198.     bool getTextTransparency() { return bTextTransparencyEnabled; }
  199.  
  200.     virtual void  setZoomFactor(float val) { zoomFactor = val; }
  201.     virtual float getZoomFactor() { return zoomFactor; }
  202.  
  203. protected:
  204.     void drawText(CDrawContext *pContext, char *string, CBitmap *newBack = 0);
  205.  
  206.     void (*stringConvert) (float value, char *string);
  207.     void (*stringConvert2) (float value, char *string, void *userData);
  208.     void (*string2FloatConvert) (char *string, float &output);
  209.     void  *userData;
  210.  
  211.     CHoriTxtAlign horiTxtAlign;
  212.     long    textStyle;    // style of text rendering
  213.     long    controlStyle;    // orientation of mouse control
  214.  
  215.     CFont   fontID;
  216.     CTxtFace txtFace;
  217.     CColor  fontColor;
  218.     CColor  backColor;
  219.     CColor  frameColor;
  220.     CColor  shadowColor;
  221.     CPoint  offset;
  222.     bool    bTextTransparencyEnabled;
  223.  
  224.     float zoomFactor;
  225. };
  226.  
  227.  
  228.  
  229. //-----------------------------------------------------------------------------
  230. //    Multi Toggle
  231. // like a COnOffButton except that it can have more than 2 states, 
  232. // & you flip through the states incrementally each time you click on it
  233. //-----------------------------------------------------------------------------
  234. class CMultiToggle : public CHorizontalSwitch
  235. {
  236. public:
  237.     CMultiToggle(const CRect &size, CControlListener *listener, long tag, 
  238.                        long subPixmaps,        // number of subPixmaps
  239.                        long heightOfOneImage,  // pixel
  240.                        CBitmap *background,
  241.                        CPoint &offset);
  242.     virtual    ~CMultiToggle();
  243.  
  244.     virtual void mouse(CDrawContext *pContext, CPoint &where);
  245.  
  246. protected:
  247. };
  248.  
  249.  
  250.  
  251. //-----------------------------------------------------------------------------
  252. //    Web Page Link
  253. // click in its space & the default browser is sent an URL
  254. // can be an on/off style button or just a clickable area
  255. //-----------------------------------------------------------------------------
  256. class CWebLink : public CControl
  257. {
  258. public:
  259.     CWebLink(const CRect &size, CControlListener *listener, long tag, 
  260.                   char *URL, CBitmap *background = 0);
  261.     virtual ~CWebLink();
  262.  
  263.     virtual void draw(CDrawContext *pContext);
  264.     virtual void mouse(CDrawContext *pContext, CPoint &where);
  265.     virtual char * getURL() { return URL; }
  266.     virtual void setURL(char *newURL) { strcpy(URL, newURL); }
  267.     virtual long getError() { return error; }
  268.     virtual bool mouseIsDown() { return mouseDown; }
  269.  
  270. protected:
  271.     void openTheURL();
  272.  
  273.     bool mouseDown;
  274.     char *URL;
  275.     char *tempURL;
  276.     long error;
  277. };
  278.  
  279.  
  280.  
  281. //-----------------------------------------------------------------------------
  282. //    Fine Tune Button
  283. // like a CKickButton, but it increases or decreases its parameter 
  284. // by a very small amount, either up or down
  285. //-----------------------------------------------------------------------------
  286.  
  287. enum    // fine tuning directions
  288. {
  289.     kFineUp,
  290.     kFineDown
  291. };
  292.  
  293. class CFineTuneButton : public CKickButton
  294. {
  295. public:
  296.     CFineTuneButton(const CRect &size, CControlListener *listener, long tag, 
  297.                     long heightOfOneImage,  // pixel
  298.                     CBitmap *background,
  299.                     CPoint &offset, 
  300.                     long style);
  301.     virtual    ~CFineTuneButton();
  302.  
  303.     virtual void mouse(CDrawContext *pContext, CPoint &where);
  304.     virtual void draw(CDrawContext *pContext);
  305.  
  306.     virtual void setIncrement(float newIncrement);
  307.     virtual float getIncrement() { return increment; }
  308.     virtual void setStyle(long newStyle);
  309.     virtual long getStyle() { return style; }
  310.  
  311. protected:
  312.     float increment;
  313.     long style;
  314.     bool mouseDown;
  315. };
  316.  
  317.  
  318. //-----------------------------------------------------------------------------
  319. //    Kick Spot
  320. // it's like a CKickButton, except that the graphics don't change 
  321. // mousedown = 1.0, mouseup = 0.0, graphics are constant
  322. //-----------------------------------------------------------------------------
  323. class CKickSpot : public CKickButton
  324. {
  325. public:
  326.     CKickSpot(const CRect &size, CControlListener *listener, long tag, 
  327.                   CBitmap *background, CPoint &offset);
  328.     virtual ~CKickSpot();
  329.  
  330.     virtual void draw(CDrawContext *pContext);
  331. };
  332.  
  333.  
  334. #endif
  335.